package com.ruoyi.zsyh.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zsyh.mapper.ZsyhPlatformFactoryMapper;
import com.ruoyi.zsyh.domain.ZsyhPlatformFactory;
import com.ruoyi.zsyh.service.IZsyhPlatformFactoryService;
import com.ruoyi.common.core.text.Convert;

/**
 * 厂家信息档案Service业务层处理
 * 
 * @author yuexl
 * @date 2021-12-08
 */
@Service
public class ZsyhPlatformFactoryServiceImpl implements IZsyhPlatformFactoryService 
{
    @Autowired
    private ZsyhPlatformFactoryMapper zsyhPlatformFactoryMapper;

    /**
     * 查询厂家信息档案
     * 
     * @param id 厂家信息档案ID
     * @return 厂家信息档案
     */
    @Override
    public ZsyhPlatformFactory selectZsyhPlatformFactoryById(String id)
    {
        return zsyhPlatformFactoryMapper.selectZsyhPlatformFactoryById(id);
    }

    public ZsyhPlatformFactory selectZsyhPlatformFactoryByPhone(String phone){
        return zsyhPlatformFactoryMapper.selectZsyhPlatformFactoryByPhone(phone);
    }

    /**
     * 查询厂家信息档案列表
     * 
     * @param zsyhPlatformFactory 厂家信息档案
     * @return 厂家信息档案
     */
    @Override
    public List<ZsyhPlatformFactory> selectZsyhPlatformFactoryList(ZsyhPlatformFactory zsyhPlatformFactory)
    {
        return zsyhPlatformFactoryMapper.selectZsyhPlatformFactoryList(zsyhPlatformFactory);
    }

    /**
     * 新增厂家信息档案
     * 
     * @param zsyhPlatformFactory 厂家信息档案
     * @return 结果
     */
    @Override
    public int insertZsyhPlatformFactory(ZsyhPlatformFactory zsyhPlatformFactory)
    {
        zsyhPlatformFactory.setCreateTime(DateUtils.getNowDate());
        return zsyhPlatformFactoryMapper.insertZsyhPlatformFactory(zsyhPlatformFactory);
    }

    /**
     * 修改厂家信息档案
     * 
     * @param zsyhPlatformFactory 厂家信息档案
     * @return 结果
     */
    @Override
    public int updateZsyhPlatformFactory(ZsyhPlatformFactory zsyhPlatformFactory)
    {
        zsyhPlatformFactory.setUpdateTime(DateUtils.getNowDate());
        return zsyhPlatformFactoryMapper.updateZsyhPlatformFactory(zsyhPlatformFactory);
    }

    /**
     * 删除厂家信息档案对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZsyhPlatformFactoryByIds(String ids)
    {
        return zsyhPlatformFactoryMapper.deleteZsyhPlatformFactoryByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除厂家信息档案信息
     * 
     * @param id 厂家信息档案ID
     * @return 结果
     */
    @Override
    public int deleteZsyhPlatformFactoryById(String id)
    {
        return zsyhPlatformFactoryMapper.deleteZsyhPlatformFactoryById(id);
    }

    @Override
    public int updateFactoryBalance(ZsyhPlatformFactory zsyhPlatformFactory) {
        return zsyhPlatformFactoryMapper.updateFactoryBalance(zsyhPlatformFactory);
    }

    public List<ZsyhPlatformFactory> getFactoryByTypeId(String typeId){
        return zsyhPlatformFactoryMapper.getFactoryByTypeId(typeId);
    }
}
